<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="dashboardMenuTag" value="myorg" scope="request"></c:set>
<c:set var="menu" value="none" scope="request"></c:set>

<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../../commons/include.jsp"/>

    <script>
        $(document).ready(function () {
            $("input[action=add]").on('click', function () {
                var org = $("form input[type=hidden][name=org]").val();
                location.href = '/front/my/org/member/createV?org=' + org;
            })


            $("table>tbody>tr :last-child>ul>li:last").on("click", function () {

                var id = $(this).closest("tr").attr("member");
                var org = $("input[name=org]").val();

              if(confirm("确定要删除吗？")){
                  $.post("/front/my/org/member/remove", {'ids[]': id}, function (data) {
                      if (data.success) {
                          location.href = location.href;
                      }
                  }, 'json');
              }

            });


            $("table>tbody>tr :last-child>ul>li:first").on("click", function () {
                var id = $(this).closest("tr").attr("member");
                var org = $("input[name=org]").val();
                location.href = "/front/my/org/member/modifyV?id=" + id;

            });


        });
    </script>
</head>
<body>


<jsp:include page="../../../commons/top.jsp"/>

<div class="main" style="min-height: 600px">
    <jsp:include page="../../../commons/dashboardMenu.jsp"/>


    <div>
        <div class="left">
            <c:set var="leftMenu" value="member" scope="request"></c:set>
            <jsp:include page="../commons/leftMenu.jsp"/>
        </div>
        <div class="right">
            <div style="width: 100%;padding: 20px 0px 20px 20px; float: left;">

                <div style="height: 40px; ">
                    <input type="button" action="add"
                           value="新&nbsp;&nbsp;&nbsp;增">
                </div>


                <div>
                    <form>
                        <input type="hidden" name="org" value="${requestScope.result.pageResult.t.org.id}">
                    </form>
                </div>



                <div style="padding: 20px 20px">
                    <span style="font-size: 16px;font-weight: bold;">共找到条${requestScope.result.pageResult.total}记录</span>
                </div>


                <div style="padding: 30px;">
                    <div style="min-height: 460px">
                        <table class="table" width="100%">
                            <thead>
                            <tr>
                                <td width="50">序号</td>
                                <td>用户名</td>
                                <td>姓名</td>
                                <td>图片</td>
                                <td>手机</td>
                                <td>邮箱</td>
                                <td>角色</td>
                                <td>操作</td>
                            </tr>
                            </thead>

                            <tbody>
                            <c:forEach items="${requestScope.result.pageResult.rows}" var="member" varStatus="status">
                                <tr member="${member.id}">

                                    <td>${status.count}</td>

                                    <td>${member.user.username}</td>
                                    <td>${member.user.realname}</td>

                                    <td><img src="${member.user.headImage}" width="30" height="30"></td>

                                    <td>${member.user.telephone}</td>
                                    <td>${member.user.email}</td>
                                    <td>${member.role.name}</td>
                                    <td style="text-align: left">
                                        <ul id="icons" class="ui-widget ui-helper-clearfix">
                                            <li class="ui-state-default ui-corner-all" title="指定角色"><span class="ui-icon ui-icon-contact"></span></li>
                                            <li class="ui-state-default ui-corner-all" title="删除"><span class="ui-icon ui-icon-trash"></span></li>
                                        </ul>
                                    </td>
                                </tr>

                            </c:forEach>
                            </tbody>
                        </table>

                    </div>


                </div>

            </div>


        </div>

    </div>

</div>


<jsp:include page="../../../commons/buttom.jsp"/>
</body>
</html>
